<?php
// +----------------------------------------------------------------------
// | Yzncms [ 御宅男工作室 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://yzncms.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | fastadmin: https://www.fastadmin.net/
// +----------------------------------------------------------------------

// +----------------------------------------------------------------------
// | 邮箱验证码接口
// +----------------------------------------------------------------------
namespace app\api\controller;

use app\admin\model\Area;
use app\admin\model\Staff;
use app\admin\model\UserModel;
use app\api\model\Order;
use app\common\controller\Api;
use app\common\library\Ems as Emslib;
use app\member\model\Member;
use think\facade\Hook;
use think\facade\Validate;

/**
 * @title 邮箱验证码接口
 * @controller api\controller\Ems
 * @group base
 */
class Index extends Api
{
    protected $noNeedLogin = [];

    //获取厂区列表
    public function getAreaList()
    {
        $data = (new Area())->getAreaList();
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg']);
    }

    //预约车辆
    public function reservationCar()
    {
        $data = (new Order())->reservationCar($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg']);
    }

    //获取预约信息
    public function getUserMakeCarInfo()
    {
        $data = (new Order())->getUserMakeCarInfo($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg']);
    }


    //扫码使用车辆和还车
    public function scanQrcode()
    {
        $data = (new Order())->scanQrcode($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg'],'',202);
    }


    //取消预约
    public function cancelOrder()
    {
        $data = (new Order())->cancelOrder($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg']);
    }


    //重新yuyue
    public function agains()
    {
        $data = (new Order())->agains($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg']);
    }


    //返回扫码状态
    public function  getUserMakeCarStatus()
    {
        $data = (new Order())->getUserMakeCarStatus($this->request_array);
        $data['code'] == 200 ? $this->success($data['msg'], $data['data']) : $this->error($data['msg']);
    }


}
